package tec;

import java.awt.Toolkit;
import java.awt.Dimension;
import java.lang.Thread;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import javax.swing.JPanel;
import javax.swing.JFrame;




class JaugeNaturelBarre extends JaugeNaturel{
	private  final Barre b; 
	private int nbAssis;


	JaugeNaturelBarre(int vigieMin,int vigieMax,int depart,boolean assis) throws IllegalArgumentException{
		super(vigieMin,vigieMax,depart);
		b= new Barre((vigieMin+vigieMax)*500);
		GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
		if(assis){
			JFrame fenetre=MesFenetres.creerUneFenetre("Barre places assises", b);
			Rectangle tailleScreen=new Rectangle();
    			tailleScreen= genv.getMaximumWindowBounds();
    			//fenetre.setLocation((int) tailleScreen.getHeight()/2,(int)tailleScreen.getWidth()/2);
			fenetre.setVisible(true);
		}
		else{
			JFrame fenetre=MesFenetres.creerUneFenetre("Barre places debouts", b);
			Rectangle tailleScreen=new Rectangle();
    			tailleScreen= genv.getMaximumWindowBounds();
    			fenetre.setLocation((int) tailleScreen.getHeight()/2,(int)tailleScreen.getWidth()/2);
			fenetre.setVisible(true);

		}
	}

	public void decrementer(){
		super.decrementer();
		b.changeTaille(nbAssis-1000);
		try{Thread.sleep(1000);}
		catch(InterruptedException e){}
	}
	public void incrementer(){
		super.incrementer();
		b.changeTaille(nbAssis+1000);
		try{Thread.sleep(1000);}
		catch(InterruptedException e){}

	}

}

